home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / boot_up / bmpshow2 / byte2raw.s < prev    next >
Text File  |  1995-04-27  |  24KB  |  714 lines

  1. ;*********************************************************************
  2. ;* Here contains 68K assembler source code to convert color byte     *
  3. ;* information into data that is suitable for a system that          *
  4. ;* displays color in a multiple plane configuration. This code       *
  5. ;* assumes each plane is offset by 16 bits (2 bytes).                *
  6. ;* Available Functions:                                              *
  7. ;*                                                                   *
  8. ;* int byte2raw8(char *color_data, char *buffer); 256 color          *
  9. ;* int byte2raw4(char *color_data, char *buffer);  16 color          *
  10. ;* int byte2raw2(char *color_data, char *buffer);   4 color          *
  11. ;* int byte2raw1(char *color_data, char *buffer);   2 color          *
  12. ;* Return value is the number of bytes written to the buffer.        *
  13.  
  14.  
  15.      export byte2raw8
  16.      export byte2raw4
  17.      export byte2raw2
  18.      export byte2raw1
  19.      text
  20.  
  21. ;*********************************************************************
  22. ;* This will convert byte color into 8 plane pixel color.            *
  23. ;* Input 16 bytes of color information.                              *
  24. ;* Output 8 integers suitable for displaying on the ATARI.           *
  25. ;*********************************************************************
  26. ;* Function:
  27. ;* int byte2raw8(char *color_data, char *buffer);
  28. ;* color_data will be converted and placed into location buffer.
  29. ;* color_data = A0. (Must be word aligned)
  30. ;* buffer     = A1. (Must be word aligned)
  31.  
  32.      
  33. byte2raw8:
  34.      movem.l  D1-D7/A0-A2,-(A7)       ; Save used registers.
  35.  
  36.      moveq.l  #0,D0                   ; Now zero them out.
  37.      moveq.l  #0,D1                   ; Pixel color store here
  38.      moveq.l  #0,D2                   ; in registers D0-D3.
  39.      moveq.l  #0,D3
  40.      
  41.      move.l   #$1, D5                 ; Set up 'OR' mask.
  42.      move.l   D5,D6
  43.      swap     D6
  44.      
  45.      adda.l   #12,A0                  ; Start at end of data.
  46.      
  47.      ; In order to plot the data in the correct order. We need
  48.      ; to reverse the order of the 16 bytes of data.
  49.      
  50.      move.l   (A0),D4                 ; Get the last 4 bytes
  51.  
  52.      ror.w    #8,D4                   ; Convert to Intel format.
  53.      swap     D4
  54.      ror.w    #8,D4
  55.      
  56.      move     #3,D7                   ; Loop 4 times (4 bytes).
  57.  
  58. .loop1:     
  59.      lsl.l    #1,D4                   ; Bit was set?
  60.      bcc      .b12                    ; Branch if not.
  61.      or.l     D5,D3                   ; Set pixel on plane 7
  62. .b12:
  63.      lsl.l    #1,D4
  64.      bcc      .b13
  65.      or.l     D6,D3                   ; Plane 6
  66. .b13:          
  67.      lsl.l    #1,D4
  68.      bcc      .b14
  69.      or.l     D5,D2                   ; Plane 5
  70. .b14:     
  71.      lsl.l    #1,D4
  72.      bcc      .b15
  73.      or.l     D6,D2                   ; Plane 4
  74. .b15:
  75.      lsl.l    #1,D4
  76.      bcc      .b16
  77.      or.l     D5,D1                   ; Plane 3
  78. .b16:     
  79.      lsl.l    #1,D4
  80.      bcc      .b17
  81.      or.l     D6,D1                   ; Plane 2
  82. .b17:
  83.      lsl.l    #1,D4
  84.      bcc      .b18
  85.      or.l     D5,D0                   ; Plane 1
  86. .b18:
  87.      lsl.l    #1,D4
  88.      bcc      .b19
  89.      or.l     D6,D0                   ; Plane 0
  90. .b19:     
  91.      lsl.l    D5                      ; Shift odd and even plane
  92.      lsl.l    D6                      ; 'OR' mask.
  93.           
  94.      dbf     D7,.loop1                ; Branch if data still available.
  95.  
  96.      suba.l   #4,A0                   ; Adjust data pointer to left
  97.      move.l   (A0),D4                 ; and get the 3rd 4 byte group.
  98.  
  99.      ror.w    #8,D4                   ; Convert long word into Intel
  100.      swap     D4                      ; format.
  101.      ror.w    #8,D4
  102.  
  103.      move     #3,D7                   ; Set up loop counter.
  104.  
  105. .loop2:     
  106.      lsl.l    #1,D4
  107.      bcc      .b22
  108.      or.l     D5,D3                   ; Plane 7
  109. .b22:
  110.      lsl.l    #1,D4
  111.      bcc      .b23
  112.      or.l     D6,D3                   ; Plane 6
  113. .b23:          
  114.      lsl.l    #1,D4
  115.      bcc      .b24
  116.      or.l     D5,D2                   ; Plane 5
  117. .b24:     
  118.      lsl.l    #1,D4
  119.      bcc      .b25
  120.      or.l     D6,D2                   ; Plane 4
  121. .b25:
  122.      lsl.l    #1,D4
  123.      bcc      .b26
  124.      or.l     D5,D1                   ; Plane 3
  125. .b26:     
  126.      lsl.l    #1,D4
  127.      bcc      .b27
  128.      or.l     D6,D1                   ; Plane 2
  129. .b27:
  130.      lsl.l    #1,D4
  131.      bcc      .b28
  132.      or.l     D5,D0                   ; Plane 1
  133. .b28:
  134.      lsl.l    #1,D4
  135.      bcc      .b29
  136.      or.l     D6,D0                   ; Plane 0
  137. .b29:     
  138.      lsl.l    D5
  139.      lsl.l    D6
  140.           
  141.      dbf     D7,.loop2
  142.  
  143.      suba.l   #4,A0                   ; Adjust data pointer left and
  144.      move.l   (A0),D4                 ; get the 2nd 4 byte group.
  145.  
  146.      ror.w    #8,D4                   ; Convert to Intel format.
  147.      swap     D4
  148.      ror.w    #8,D4
  149.  
  150.      move     #3,D7                   ; Set up loop counter.
  151.  
  152. .loop3:     
  153.      lsl.l    #1,D4
  154.      bcc      .b32
  155.      or.l     D5,D3                   ; Plane 7
  156. .b32:
  157.      lsl.l    #1,D4
  158.      bcc      .b33
  159.      or.l     D6,D3                   ; Plane 6
  160. .b33:          
  161.      lsl.l    #1,D4
  162.      bcc      .b34
  163.      or.l     D5,D2                   ; Plane 5
  164. .b34:     
  165.      lsl.l    #1,D4
  166.      bcc      .b35
  167.      or.l     D6,D2                   ; Plane 4
  168. .b35:
  169.      lsl.l    #1,D4
  170.      bcc      .b36
  171.      or.l     D5,D1                   ; Plane 3
  172. .b36:     
  173.      lsl.l    #1,D4
  174.      bcc      .b37
  175.      or.l     D6,D1                   ; Plane 2
  176. .b37:
  177.      lsl.l    #1,D4
  178.      bcc      .b38
  179.      or.l     D5,D0                   ; Plane 1
  180. .b38:
  181.      lsl.l    #1,D4
  182.      bcc      .b39
  183.      or.l     D6,D0                   ; Plane 0
  184. .b39:     
  185.      lsl.l    D5
  186.      lsl.l    D6
  187.           
  188.      dbf     D7,.loop3
  189.  
  190.      suba.l   #4,A0                   ; Adjust data pointer left and
  191.      move.l   (A0),D4                 ; get the first 4 bytes.
  192.  
  193.      ror.w    #8,D4                   ; Shift data to intel format.
  194.      swap     D4
  195.      ror.w    #8,D4
  196.  
  197.      move     #3,D7                   ; Loop 4 times.
  198.  
  199. .loop4:     
  200.      lsl.l    #1,D4
  201.      bcc      .b42
  202.      or.l     D5,D3                   ; Plane 7
  203. .b42:
  204.      lsl.l    #1,D4
  205.      bcc      .b43
  206.      or.l     D6,D3                   ; Plane 6
  207. .b43:          
  208.      lsl.l    #1,D4
  209.      bcc      .b44
  210.      or.l     D5,D2                   ; Plane 5
  211. .b44:     
  212.      lsl.l    #1,D4
  213.      bcc      .b45
  214.      or.l     D6,D2                   ; Plane 4
  215. .b45:
  216.      lsl.l    #1,D4
  217.      bcc      .b46
  218.      or.l     D5,D1                   ; Plane 3
  219. .b46:     
  220.      lsl.l    #1,D4
  221.      bcc      .b47
  222.      or.l     D6,D1                   ; Plane 2
  223. .b47:
  224.      lsl.l    #1,D4
  225.      bcc      .b48
  226.      or.l     D5,D0                   ; Plane 1
  227. .b48:
  228.      lsl.l    #1,D4
  229.      bcc      .b49
  230.      or.l     D6,D0                   ; Plane 0
  231. .b49:     
  232.      lsl.l    D5
  233.      lsl.l    D6
  234.           
  235.      dbf     D7,.loop4
  236.           
  237.      movem.l  D0-D3,(A1)              ; Now move the data into
  238.                                       ; buffer.
  239.      movem.l (A7)+,D1-D7/A0-A2        ; Restore used registers.
  240.  
  241.      move.l  #16,D0                   ; Return number of bytes written.
  242.      rts                              ; Return to calling function.
  243.  
  244. ;*********************************************************************
  245. ;* This will convert byte color into 4 plane pixel color.            *
  246. ;* Input 16 bytes of color information.                              *
  247. ;* Output 4 integers suitable for displaying on the ATARI.           *
  248. ;*********************************************************************
  249. ;* Function:
  250. ;* int byte2raw4(char *color_data, char *buffer);
  251. ;* color_data will be converted and placed into location buffer.
  252. ;* color_data = A0. (Must be word aligned)
  253. ;* buffer     = A1. (Must be word aligned)
  254.  
  255. byte2raw4:
  256.      movem.l  D2-D7/A0-A2,-(A7)       ; Save used registers.
  257.  
  258.      moveq.l  #0,D2                   ; in registers D0-D3.
  259.      moveq.l  #0,D3
  260.      
  261.      move.l   #$1, D5                 ; Set up 'OR' mask.
  262.      move.l   D5,D6
  263.      swap     D6
  264.      
  265.      adda.l   #12,A0                  ; Start at end of data.
  266.      
  267.      ; In order to plot the data in the correct order. We need
  268.      ; to reverse the order of the 16 bytes of data.
  269.      
  270.      move.l   (A0),D4                 ; Get the last 4 bytes
  271.  
  272.      ror.w    #8,D4                   ; Convert to Intel format.
  273.      swap     D4
  274.      ror.w    #8,D4
  275.      
  276.      move     #3,D7                   ; Loop 4 times (4 bytes).
  277.  
  278. .loop1:     
  279.      lsl.l    #4,D4                   ; First four bits unused.
  280.      
  281.      lsl.l    #1,D4                   ; Bit was set?
  282.      bcc      .b12                    ; Branch if not.
  283.      or.l     D5,D3                   ; Set pixel on plane 3
  284. .b12:
  285.      lsl.l    #1,D4
  286.      bcc      .b13
  287.      or.l     D6,D3                   ; Plane 2
  288. .b13:          
  289.      lsl.l    #1,D4
  290.      bcc      .b14
  291.      or.l     D5,D2                   ; Plane 1
  292. .b14:     
  293.      lsl.l    #1,D4
  294.      bcc      .b15
  295.      or.l     D6,D2                   ; Plane 0
  296. .b15:
  297.      
  298.      lsl.l    D5                      ; Shift odd and even plane
  299.      lsl.l    D6                      ; 'OR' mask.
  300.           
  301.      dbf     D7,.loop1                ; Branch if data still available.
  302.  
  303.      suba.l   #4,A0                   ; Adjust data pointer to left
  304.      move.l   (A0),D4                 ; and get the 3rd 4 byte group.
  305.  
  306.      ror.w    #8,D4                   ; Convert long word into Intel
  307.      swap     D4                      ; format.
  308.      ror.w    #8,D4
  309.  
  310.      move     #3,D7                   ; Set up loop counter.
  311.  
  312. .loop2:     
  313.      lsl.l    #4,D4                   ; First 4 bits unused.
  314.      
  315.      lsl.l    #1,D4
  316.      bcc      .b22
  317.      or.l     D5,D3                   ; Plane 3
  318. .b22:
  319.      lsl.l    #1,D4
  320.      bcc      .b23
  321.      or.l     D6,D3                   ; Plane 2
  322. .b23:          
  323.      lsl.l    #1,D4
  324.      bcc      .b24
  325.      or.l     D5,D2                   ; Plane 1
  326. .b24:     
  327.      lsl.l    #1,D4
  328.      bcc      .b25
  329.      or.l     D6,D2                   ; Plane 0
  330. .b25:
  331.      lsl.l    D5
  332.      lsl.l    D6
  333.           
  334.      dbf     D7,.loop2
  335.  
  336.      suba.l   #4,A0                   ; Adjust data pointer left and
  337.      move.l   (A0),D4                 ; get the 2nd 4 byte group.
  338.  
  339.      ror.w    #8,D4                   ; Convert to Intel format.
  340.      swap     D4
  341.      ror.w    #8,D4
  342.  
  343.      move     #3,D7                   ; Set up loop counter.
  344.  
  345. .loop3:     
  346.      lsl.l    #4,D4                   ; First 4 bits unused.
  347.      
  348.      lsl.l    #1,D4
  349.      bcc      .b32
  350.      or.l     D5,D3                   ; Plane 3
  351. .b32:
  352.      lsl.l    #1,D4
  353.      bcc      .b33
  354.      or.l     D6,D3                   ; Plane 2
  355. .b33:          
  356.      lsl.l    #1,D4
  357.      bcc      .b34
  358.      or.l     D5,D2                   ; Plane 1
  359. .b34:     
  360.      lsl.l    #1,D4
  361.      bcc      .b35
  362.      or.l     D6,D2                   ; Plane 0
  363. .b35:
  364.      lsl.l    D5
  365.      lsl.l    D6
  366.           
  367.      dbf     D7,.loop3
  368.  
  369.      suba.l   #4,A0                   ; Adjust data pointer left and
  370.      move.l   (A0),D4                 ; get the first 4 bytes.
  371.  
  372.      ror.w    #8,D4                   ; Shift data to intel format.
  373.      swap     D4
  374.      ror.w    #8,D4
  375.  
  376.      move     #3,D7                   ; Loop 4 times.
  377.  
  378. .loop4:     
  379.      lsl.l    #4,D4                   ; First 4 bits unused.
  380.      
  381.      lsl.l    #1,D4
  382.      bcc      .b42
  383.      or.l     D5,D3                   ; Plane 3
  384. .b42:
  385.      lsl.l    #1,D4
  386.      bcc      .b43
  387.      or.l     D6,D3                   ; Plane 2
  388. .b43:          
  389.      lsl.l    #1,D4
  390.      bcc      .b44
  391.      or.l     D5,D2                   ; Plane 1
  392. .b44:     
  393.      lsl.l    #1,D4
  394.      bcc      .b45
  395.      or.l     D6,D2                   ; Plane 0
  396. .b45:
  397.      lsl.l    D5
  398.      lsl.l    D6
  399.           
  400.      dbf     D7,.loop4
  401.  
  402.      movem.l  D2/D3,(A1)              ; Now move the data into
  403.                                       ; buffer.
  404.  
  405.      movem.l (A7)+,D2-D7/A0-A2        ; Restore used registers.
  406.  
  407.      move.l  #8,D0                    ; Number of bytes written. 
  408.      rts                              ; Return to calling function.
  409.  
  410. ;*********************************************************************
  411. ;* This will convert byte color into 2 plane pixel color.            *
  412. ;* Input 16 bytes of color information.                              *
  413. ;* Output 2 integers suitable for displaying on the ATARI.           *
  414. ;*********************************************************************
  415. ;* Function:
  416. ;* int byte2raw2(char *color_data, char *buffer);
  417. ;* color_data will be converted and placed into location buffer.
  418. ;* color_data = A0. (Must be word aligned)
  419. ;* buffer     = A1. (Must be word aligned)
  420.  
  421. byte2raw2:
  422.      movem.l  D3-D7/A0-A2,-(A7)       ; Save used registers.
  423.  
  424.      moveq.l  #0,D3                   ; in registers D0-D3.
  425.      
  426.      move.l   #$1, D5                 ; Set up 'OR' mask.
  427.      move.l   D5,D6
  428.      swap     D6
  429.      
  430.      adda.l   #12,A0                  ; Start at end of data.
  431.      
  432.      ; In order to plot the data in the correct order. We need
  433.      ; to reverse the order of the 16 bytes of data.
  434.      
  435.      move.l   (A0),D4                 ; Get the last 4 bytes
  436.  
  437.      ror.w    #8,D4                   ; Convert to Intel format.
  438.      swap     D4
  439.      ror.w    #8,D4
  440.      
  441.      move     #3,D7                   ; Loop 4 times (4 bytes).
  442.  
  443. .loop1:     
  444.      lsl.l    #6,D4                   ; First four bits unused.
  445.      
  446.      lsl.l    #1,D4                   ; Bit was set?
  447.      bcc      .b12                    ; Branch if not.
  448.      or.l     D5,D3                   ; Set pixel on plane 1
  449. .b12:
  450.      lsl.l    #1,D4
  451.      bcc      .b13
  452.      or.l     D6,D3                   ; Plane 0
  453. .b13:          
  454.      
  455.      lsl.l    D5                      ; Shift odd and even plane
  456.      lsl.l    D6                      ; 'OR' mask.
  457.           
  458.      dbf     D7,.loop1                ; Branch if data still available.
  459.  
  460.      suba.l   #4,A0                   ; Adjust data pointer to left
  461.      move.l   (A0),D4                 ; and get the 3rd 4 byte group.
  462.  
  463.      ror.w    #8,D4                   ; Convert long word into Intel
  464.      swap     D4                      ; format.
  465.      ror.w    #8,D4
  466.  
  467.      move     #3,D7                   ; Set up loop counter.
  468.  
  469. .loop2:     
  470.      lsl.l    #6,D4                   ; First 6 bits unused.
  471.      
  472.      lsl.l    #1,D4
  473.      bcc      .b22
  474.      or.l     D5,D3                   ; Plane 1
  475. .b22:
  476.      lsl.l    #1,D4
  477.      bcc      .b23
  478.      or.l     D6,D3                   ; Plane 0
  479. .b23:          
  480.      lsl.l    D5
  481.      lsl.l    D6
  482.           
  483.      dbf     D7,.loop2
  484.  
  485.      suba.l   #4,A0                   ; Adjust data pointer left and
  486.      move.l   (A0),D4                 ; get the 2nd 4 byte group.
  487.  
  488.      ror.w    #8,D4                   ; Convert to Intel format.
  489.      swap     D4
  490.      ror.w    #8,D4
  491.  
  492.      move     #3,D7                   ; Set up loop counter.
  493.  
  494. .loop3:     
  495.      lsl.l    #6,D4                   ; First 6 bits unused.
  496.      
  497.      lsl.l    #1,D4
  498.      bcc      .b32
  499.      or.l     D5,D3                   ; Plane 1
  500. .b32:
  501.      lsl.l    #1,D4
  502.      bcc      .b33
  503.      or.l     D6,D3                   ; Plane 0
  504. .b33:          
  505.      lsl.l    D5
  506.      lsl.l    D6
  507.           
  508.      dbf     D7,.loop3
  509.  
  510.      suba.l   #4,A0                   ; Adjust data pointer left and
  511.      move.l   (A0),D4                 ; get the first 4 bytes.
  512.  
  513.      ror.w    #8,D4                   ; Shift data to intel format.
  514.      swap     D4
  515.      ror.w    #8,D4
  516.  
  517.      move     #3,D7                   ; Loop 4 times.
  518.  
  519. .loop4:     
  520.      lsl.l    #6,D4                   ; First 4 bits unused.
  521.      
  522.      lsl.l    #1,D4
  523.      bcc      .b42
  524.      or.l     D5,D3                   ; Plane 3
  525. .b42:
  526.      lsl.l    #1,D4
  527.      bcc      .b43
  528.      or.l     D6,D3                   ; Plane 2
  529. .b43:          
  530.      lsl.l    D5
  531.      lsl.l    D6
  532.           
  533.      dbf     D7,.loop4
  534.  
  535.      move.l  D3,(A1)                  ; Now move the data into
  536.                                       ; buffer.
  537.      movem.l (A7)+,D3-D7/A0-A2        ; Restore used registers.
  538.  
  539.      move.l  #4,D0                    ; Number of bytes written. 
  540.      rts                              ; Return to calling function.
  541.  
  542. ;*********************************************************************
  543. ;* This will convert byte color into 2 plane pixel color.            *
  544. ;* Input 16 bytes of color information.                              *
  545. ;* Output 1 integers suitable for displaying on the ATARI.           *
  546. ;*********************************************************************
  547. ;* Function:
  548. ;* int byte2raw1(char *color_data, char *buffer);
  549. ;* color_data will be converted and placed into location buffer.
  550. ;* color_data = A0. (Must be word aligned)
  551. ;* buffer     = A1. (Must be word aligned)
  552.  
  553. byte2raw1:
  554.      movem.l  D3-D7/A0-A2,-(A7)       ; Save used registers.
  555.  
  556.      moveq.l  #0,D3                   ; Zero register D3.
  557.  
  558.      ; In order to plot the data in the correct order. We need
  559.      ; to reverse the order of the 16 bytes of data.
  560.  
  561.      adda.l   #12,A0                  ; Start at end of data.     
  562.      move.l   (A0),D4                 ; Get the last 4 bytes
  563.  
  564.      ror.w    #8,D4                   ; Convert to Intel format.
  565.      swap     D4
  566.      ror.w    #8,D4
  567.           
  568.      move.l   #$1, D5                 ; Set up 'OR' mask.
  569.      lsl.l    #7,D4                   ; First 7 bits unused.
  570.      
  571.      lsl.l    #1,D4                   ; Bit was set?
  572.      bcc      .b12                    ; Branch if not.
  573.      or.l     D5,D3                   ; Set pixel on plane 1
  574. .b12:    
  575.      lsl.l    D5                      ; Shift 'OR' mask.
  576.      lsl.l    #7,D4                   ; First 7 bits unused.
  577.      
  578.      lsl.l    #1,D4                   ; Bit was set?
  579.      bcc      .b13                    ; Branch if not.
  580.      or.l     D5,D3                   ; Set pixel on plane 1
  581. .b13:    
  582.      lsl.l    D5                      ; Shift 'OR' mask.
  583.      lsl.l    #7,D4                   ; First 7 bits unused.
  584.      
  585.      lsl.l    #1,D4                   ; Bit was set?
  586.      bcc      .b14                    ; Branch if not.
  587.      or.l     D5,D3                   ; Set pixel on plane 1
  588. .b14:    
  589.      lsl.l    D5                      ; Shift 'OR' mask.
  590.      lsl.l    #7,D4                   ; First 7 bits unused.
  591.      
  592.      lsl.l    #1,D4                   ; Bit was set?
  593.      bcc      .b15                    ; Branch if not.
  594.      or.l     D5,D3                   ; Set pixel on plane 1
  595. .b15:    
  596.  
  597.      subq.l   #4,A0
  598.      move.l   (A0),D4                 ; Get 4 bytes
  599.  
  600.      ror.w    #8,D4                   ; Convert to Intel format.
  601.      swap     D4
  602.      ror.w    #8,D4
  603.           
  604.      lsl.l    D5                      ; Shift 'OR' mask.
  605.      lsl.l    #7,D4                   ; First 7 bits unused.
  606.      
  607.      lsl.l    #1,D4                   ; Bit was set?
  608.      bcc      .b22                    ; Branch if not.
  609.      or.l     D5,D3                   ; Set pixel on plane 1
  610. .b22:    
  611.      lsl.l    D5                      ; Shift 'OR' mask.
  612.      lsl.l    #7,D4                   ; First 7 bits unused.
  613.      
  614.      lsl.l    #1,D4                   ; Bit was set?
  615.      bcc      .b23                    ; Branch if not.
  616.      or.l     D5,D3                   ; Set pixel on plane 1
  617. .b23:    
  618.      lsl.l    D5                      ; Shift 'OR' mask.
  619.      lsl.l    #7,D4                   ; First 7 bits unused.
  620.      
  621.      lsl.l    #1,D4                   ; Bit was set?
  622.      bcc      .b24                    ; Branch if not.
  623.      or.l     D5,D3                   ; Set pixel on plane 1
  624. .b24:    
  625.      lsl.l    D5                      ; Shift 'OR' mask.
  626.      lsl.l    #7,D4                   ; First 7 bits unused.
  627.      
  628.      lsl.l    #1,D4                   ; Bit was set?
  629.      bcc      .b25                    ; Branch if not.
  630.      or.l     D5,D3                   ; Set pixel on plane 1
  631. .b25:    
  632.  
  633.      subq.l   #4,A0
  634.      move.l   (A0),D4                 ; Get 4 bytes
  635.  
  636.      ror.w    #8,D4                   ; Convert to Intel format.
  637.      swap     D4
  638.      ror.w    #8,D4
  639.           
  640.      lsl.l    D5                      ; Shift 'OR' mask.
  641.      lsl.l    #7,D4                   ; First 7 bits unused.
  642.      
  643.      lsl.l    #1,D4                   ; Bit was set?
  644.      bcc      .b32                    ; Branch if not.
  645.      or.l     D5,D3                   ; Set pixel on plane 1
  646. .b32:    
  647.      lsl.l    D5                      ; Shift 'OR' mask.
  648.      lsl.l    #7,D4                   ; First 7 bits unused.
  649.      
  650.      lsl.l    #1,D4                   ; Bit was set?
  651.      bcc      .b33                    ; Branch if not.
  652.      or.l     D5,D3                   ; Set pixel on plane 1
  653. .b33:    
  654.      lsl.l    D5                      ; Shift 'OR' mask.
  655.      lsl.l    #7,D4                   ; First 7 bits unused.
  656.      
  657.      lsl.l    #1,D4                   ; Bit was set?
  658.      bcc      .b34                    ; Branch if not.
  659.      or.l     D5,D3                   ; Set pixel on plane 1
  660. .b34:    
  661.      lsl.l    D5                      ; Shift 'OR' mask.
  662.      lsl.l    #7,D4                   ; First 7 bits unused.
  663.      
  664.      lsl.l    #1,D4                   ; Bit was set?
  665.      bcc      .b35                    ; Branch if not.
  666.      or.l     D5,D3                   ; Set pixel on plane 1
  667. .b35:    
  668.           
  669.      subq.l   #4,A0
  670.      move.l   (A0),D4                 ; Get 4 bytes
  671.  
  672.      ror.w    #8,D4                   ; Convert to Intel format.
  673.      swap     D4
  674.      ror.w    #8,D4
  675.           
  676.      lsl.l    D5                      ; Shift 'OR' mask.
  677.      lsl.l    #7,D4                   ; First 7 bits unused.
  678.      
  679.      lsl.l    #1,D4                   ; Bit was set?
  680.      bcc      .b42                    ; Branch if not.
  681.      or.l     D5,D3                   ; Set pixel on plane 1
  682. .b42:    
  683.      lsl.l    D5                      ; Shift 'OR' mask.
  684.      lsl.l    #7,D4                   ; First 7 bits unused.
  685.      
  686.      lsl.l    #1,D4                   ; Bit was set?
  687.      bcc      .b43                    ; Branch if not.
  688.      or.l     D5,D3                   ; Set pixel on plane 1
  689. .b43:    
  690.      lsl.l    D5                      ; Shift 'OR' mask.
  691.      lsl.l    #7,D4                   ; First 7 bits unused.
  692.      
  693.      lsl.l    #1,D4                   ; Bit was set?
  694.      bcc      .b44                    ; Branch if not.
  695.      or.l     D5,D3                   ; Set pixel on plane 1
  696. .b44:    
  697.      lsl.l    D5                      ; Shift 'OR' mask.
  698.      lsl.l    #7,D4                   ; First 7 bits unused.
  699.      
  700.      lsl.l    #1,D4                   ; Bit was set?
  701.      bcc      .b45                    ; Branch if not.
  702.      or.l     D5,D3                   ; Set pixel on plane 1
  703. .b45:    
  704.  
  705.      move.w  D3,(A1)                  ; Now move the data into
  706.                                       ; buffer.
  707.      movem.l (A7)+,D3-D7/A0-A2        ; Restore used registers.
  708.  
  709.      move.l  #2,D0                    ; Number of bytes written. 
  710.      rts                              ; Return to calling function.
  711.                 
  712. end_loop:
  713.      bra end_loop                     ; just in case.
  714.      end